import { createStore, Store, useStore } from 'vuex';
import { rootState, comType } from './types';
import login from './login/login';

const store = createStore<rootState>({
  state() {
    return {
      name: '',
      login: {}
    };
  },
  mutations: {},
  actions: {},
  getters: {},
  modules: {
    login
  }
});

export function loadStoreLogin() {
  store.dispatch('login/setupLoginStore');
}

export function myStore(): Store<comType> {
  return useStore();
}

export default store;
